package com.huiquan.foundation.dao;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.huiquan.foundation.domain.UserRecord;
import com.huiquan.framework.base.EnhancedBaseDao;
import com.huiquan.framework.utils.DateUtils;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class UserRecordDao extends EnhancedBaseDao<UserRecord> {

	@Resource(name = "sqlMapClient")
	private SqlMapClient sqlMapClient;

	public static final String space = "USER_RECORD.";

	public UserRecordDao() {
		super(space);
	}

	public Long retrieveCountByDateRoleUid(long uid, Date date) {
		Map<String, Object> param = new HashMap<>();
		param.put("uid", uid);
		param.put("date", DateUtils.convertDateFormat(date, DateUtils.DateFormat.DATE));
		return (Long) this.object(space + "RETRIEVE_COUNT_BY_DATE_ROLE_UID", param, sqlMapClient);
	}
}
